package com.cman777.springc.common.helper;

import org.apache.commons.lang3.Validate;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.reflect.MethodSignature;

import java.lang.reflect.Method;

/**
 * @author chenzhicong
 * @time 2019/11/9 18:19
 * @description
 */
public class AopUtil {
    /**
     *
     * @param proceedingJoinPoint
     * @return
     */
    public static Method around2Method(ProceedingJoinPoint proceedingJoinPoint) {
        Signature signature = proceedingJoinPoint.getSignature();
        Validate.isTrue(signature instanceof MethodSignature);

        MethodSignature methodSignature = (MethodSignature) signature;
        return methodSignature.getMethod();
    }
}
